package core_prepare

import (
	"fmt"
	"github.com/kataras/iris/v12"
	"iris_test/config"
	models "iris_test/models/supsite"
	"sync"
)

var PrepareArr = map[string]func(group *sync.WaitGroup, ctx iris.Context) {
	"router" : initRouteInfo,
	"jump"   : init301Jump,
	"urlmap" : initOldNew,
	"forbid" : checkForbiddren,
}
// 初始化路由数据
func initRouteInfo(wg *sync.WaitGroup, ctx iris.Context)  {
	defer wg.Done()
    initRoute(ctx)
	fmt.Println("初始化路由")
}
// 校验301跳转
func init301Jump(wg *sync.WaitGroup, ctx iris.Context)  {
	defer wg.Done()
	redUrl := new(models.SiteRedirect).Init().GetRedirectInfo(config.Conf["siteid"].(string), ctx.Request().URL.Path)
	fmt.Println(redUrl)
	fmt.Println("301跳转")
}
//校验新旧地址的301跳转
func initOldNew(wg *sync.WaitGroup, ctx iris.Context) {
	defer wg.Done()
	fmt.Println("oldnew地址校验")
}

//校验屏蔽页面访问
func checkForbiddren(wg *sync.WaitGroup, ctx iris.Context) {
	defer wg.Done()
	fmt.Println("check forbid")
}
